#include <stdio.h>

int main()
{
    int len = 0;
    printf("Input the vector length: ");
    scanf("%d", &len);

    int vec[len], contianer[len], containerNumber[len];
    printf("Input the vector: ");
    for (int i = 0; i < len; i++) {
        scanf(" %d", &vec[i]);
        contianer[i] = 100;
    }
    
    for (int i = 0; i < len; i++) {
        for (int j = 0; j < len; j++) {
            if (contianer[j] >= vec[i]) {
                containerNumber[i] = j + 1;
                contianer[j] -= vec[i];
                break;
            } else
                continue;
        }
    }

    for (int i = 0; i < len; i++) 
        printf("%d %d\n", vec[i], containerNumber[i]);

    return 0;
}